<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="com.frame.TheUser" %>
<%@ page import="com.frame.Http_Request" %>
<%@ page errorPage="Login.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
<%

String userName = request.getParameter("userid");
String password = request.getParameter("password");

if((userName == null) || (password == null))
	{
	  throw new Exception("No UserName or No Password");
	}

TheUser loginUser = new TheUser(userName,password);

if(!loginUser.Login()) 
	{
   throw new Exception("invalid password");
 }		

try
{
		
	Http_Request hreq = new Http_Request(request);
	
	hreq.Add_Parameter(Http_Request.ARG_RANGE_SESSION, "session.userid", loginUser.getUserID());//SCOPE,SESSION name,SESSION value
	//hreq.Add_Parameter(Http_Request.ARG_RANGE_SESSION, "session.roleid", loginUser.getUserRole());
	//hreq.Add_Parameter(Http_Request.ARG_RANGE_REQUEST,"request.userid",loginUser.getUserID());
	
 }
 catch(Exception e)
 {
	throw new Exception(e.getMessage());
 }		
 
 
 //out.println("window.navigate('Main/Index.jsp');");
  out.println("window.navigate('shop/sort.jsp');");
%>


</script>
</head>
<body>
<c:set value="${sessionScope.Arg_In_Session['session.userid']}" var="userid" scope="session"/>
</body>
</html>